
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms.Design;
namespace Fcdbas.WinUI.Design
{
	public class F1PropertyTab : PropertyTab
	{
		public override string TabName
		{
			get
			{
				return "F1 Properties";
			}
		}
		public override Bitmap Bitmap
		{
			get
			{
                return global::Fcdbas.WinUI.Properties.Resources.F1PropertyTab;
			}
		}
		private bool IsF1Property(PropertyDescriptor property)
		{
			return property.Category == "F1 Data Source" || property.Category == "F1 Options" || property.Category == "F1 Address Objects" || property.Category == "F1 Flags" || property.Category == "F1 Data Item" || property.Category == "F1 Allowed Operations" || property.Category == "F1 Tree List" || property.Category == "F1 Commander" || property.Category == "F1 Wizard Options";
		}
		public override PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes)
		{
			return this.GetProperties(null, component, attributes);
		}
		public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object component, Attribute[] attributes)
		{
			if (attributes == null)
			{
				attributes = new Attribute[]
				{
					BrowsableAttribute.Yes
				};
			}
			PropertyDescriptorCollection properties;
			if (context != null)
			{
				TypeConverter typeConverter = (context.PropertyDescriptor == null) ? TypeDescriptor.GetConverter(component) : context.PropertyDescriptor.Converter;
				if (typeConverter != null && typeConverter.GetPropertiesSupported(context))
				{
					properties = typeConverter.GetProperties(context, component, attributes);
				}
			}
			properties = TypeDescriptor.GetProperties(component, attributes);
			PropertyDescriptorCollection result = PropertyDescriptorCollection.Empty;
			if (properties.Count > 0)
			{
				ArrayList arrayList = null;
				for (int i = 0; i < properties.Count; i++)
				{
					PropertyDescriptor propertyDescriptor = properties[i];
					if (this.IsF1Property(propertyDescriptor))
					{
						if (arrayList == null)
						{
							arrayList = new ArrayList();
						}
						propertyDescriptor = TypeDescriptor.CreateProperty(propertyDescriptor.ComponentType, propertyDescriptor, null);
						arrayList.Add(propertyDescriptor);
					}
				}
				if (arrayList != null)
				{
					PropertyDescriptor[] array = new PropertyDescriptor[arrayList.Count];
					arrayList.CopyTo(array, 0);
					result = new PropertyDescriptorCollection(array);
				}
			}
			return result;
		}
	}
}
